其他
免费公开课:交叠DID偏误及Bacon分解+案例应用
35分钟视频学习TWFE偏误及Bacon分解+案例应用
内容简介
这个视频主要介绍多时点DID得到的平均处理效应是由分解出来的单时点dd处理效应的加权平均。
1、TWFE偏误 2、手工绘图展示2*2DID分组产生的DID系数加权平均 3、Bacon分解命令介绍 4、单边离婚法案对自杀率的案例
视频涉及主要命令拓展学习
reghdfe xtreg eventdd bacondecomp
参考文章:
Andrew Goodman-Bacon 《Difference-in-differences with variation in treatment timing》 Wolfers, Justin, 2006. Did unilateral divorce laws raise divorce rates? A reconciliation and new results. Amer. Econ. Rev. 96 (5), 1802–1820.
bacondecomp命令介绍:
bacondecomp varlist [if] [in] [weight] [, options]
where varlist is
outcome treatment_indicator [controls]
options Description
--------------------------------------------------------------------------------------------------------------
gropt(string) options to pass to graph command
stub(string) specify a prefix for variables to be created holding decomp results
ddetail option for more detailed decomposition (allowed without weights or controls)
other options options to pass to xtreg command
操作结果展示:
案例应用
老版本分解结果
分解图
数据结构查看
TWFE双向固定效应模型估计结果
新版本结果展示
老版本结果
. . bacondecomp asmrs post , ddetail
Calculating treatment times...
Calculating weights...
Estimating 2x2 diff-in-diff regressions...
Diff-in-diff estimate: -3.080
DD Comparison Weight Avg DD Est
-------------------------------------------------
Earlier T vs. Later C 0.111 -0.187
Later T vs. Earlier C 0.265 3.512
T vs. Never treated 0.240 -5.331
T vs. Already treated 0.384 -7.044
-------------------------------------------------
T = Treatment; C = Control
.
end of do-file
. dis 0.111 * -0.187+0.265*3.512+0.240 * -5.331+ 0.384 *-7.044
-3.074413
.
新版本结果
bacondecomp asmrs post , ddetail
Computing decomposition across 14 timing groups
including an always-treated group and a never-treated group
------------------------------------------------------------------------------
asmrs | Coef. Std. Err. z P>|z| [95% Conf. Interval]
-------------+----------------------------------------------------------------
post | -3.079926 1.111656 -2.77 0.006 -5.258732 -.9011193
------------------------------------------------------------------------------
Bacon Decomposition
/*
+---------------------------------------------------+
| | Beta TotalWeight |
|----------------------+----------------------------|
| Early_v_Late | 3.089867353 .0001259938 |
| Late_v_Early | -23.83420181 .0006803664 |
| Early_v_Late | .7286439538 .0008819564 |
| Late_v_Early | -8.258329391 .0045861736 |
| Early_v_Late | 2.404874802 .0005291738 |
| Late_v_Early | 22.15005112 .0022930868 |
| Early_v_Late | 1.676301956 .000566972 |
| Late_v_Early | -7.148348331 .00283486 |
| Early_v_Late | 4.613049507 .0004535776 |
| Late_v_Early | 26.58180046 .0018899067 |
| Early_v_Late | -7.006736755 .0009260543 |
| Late_v_Early | -5.394356728 .0033073366 |
| Early_v_Late | .6727053523 .0025198756 |
| Late_v_Early | -7.43382597 .012095402 |
| Early_v_Late | 3.899661064 .0022678879 |
| Late_v_Early | 27.04117584 .0090715515 |
| Early_v_Late | -7.521428585 .0061736949 |
| Late_v_Early | -6.398066521 .0211669536 |
| Early_v_Late | -3.244979858 .0015119253 |
| Late_v_Early | -3.630996227 .0045357758 |
| Early_v_Late | .1488796175 .0009449533 |
| Late_v_Early | -5.158778191 .0043467852 |
| Early_v_Late | -2.910137653 .0009071552 |
| Late_v_Early | 23.89071274 .0034774283 |
| Early_v_Late | -9.381551743 .0027781627 |
| Late_v_Early | -6.318483829 .009128249 |
| Early_v_Late | -8.437994003 .0009071552 |
| Late_v_Early | -6.468858719 .0026080712 |
| Early_v_Late | 4.291956902 .001700916 |
| Late_v_Early | 6.192469597 .0043467852 |
| Early_v_Late | 9.615415573 .0007559626 |
| Late_v_Early | .6682447195 .0033262358 |
| Early_v_Late | 5.732773304 .0007559626 |
| Late_v_Early | 29.61791611 .002771863 |
| Early_v_Late | 2.411342144 .002469478 |
| Late_v_Early | 4.052882671 .0077612166 |
| Early_v_Late | 5.130411148 .0009071552 |
| Late_v_Early | 4.886719704 .0024946767 |
| Early_v_Late | 8.392121315 .0022678879 |
| Late_v_Early | 10.78344917 .0055437261 |
| Early_v_Late | 3.15568161 .0003779813 |
| Late_v_Early | 3.873969555 .0008315589 |
| Early_v_Late | 3.482367754 .0004409782 |
| Late_v_Early | 4.239864349 .0018521086 |
| Early_v_Late | -7.72107935 .0004535776 |
| Late_v_Early | 28.58859062 .0015875215 |
| Early_v_Late | -8.404179573 .0015434237 |
| Late_v_Early | 3.740804911 .0046302713 |
| Early_v_Late | -9.093745232 .0006047701 |
| Late_v_Early | .6837824583 .0015875215 |
| Early_v_Late | 1.421976328 .001700916 |
| Late_v_Early | 11.66159821 .0039688039 |
| Early_v_Late | -16.38343239 .0003779813 |
| Late_v_Early | -6.338175297 .0007937608 |
| Early_v_Late | -14.61515999 .0001385932 |
| Late_v_Early | -7.964285851 .0002645869 |
| Early_v_Late | -3.567538977 .0015119253 |
| Late_v_Early | -13.05292702 .006047701 |
| Early_v_Late | -10.86773682 .0015875215 |
| Late_v_Early | 13.24829674 .0052917384 |
| Early_v_Late | -7.6874547 .0055563254 |
| Late_v_Early | -9.137350082 .0158752156 |
| Early_v_Late | -6.326669693 .0022678879 |
| Late_v_Early | -11.05425262 .0056697199 |
| Early_v_Late | 4.825609684 .0068036641 |
| Late_v_Early | .64386338 .0151192535 |
| Early_v_Late | 2.691236258 .001700916 |
| Late_v_Early | -4.655465126 .0034018321 |
| Early_v_Late | 1.836740971 .0008315589 |
| Late_v_Early | -6.611749649 .0015119253 |
| Early_v_Late | 20.30932999 .0002267888 |
| Late_v_Early | 7.368327141 .0003779813 |
| Early_v_Late | 3.358542204 .0006929658 |
| Late_v_Early | -4.764940262 .0023560837 |
| Early_v_Late | -9.930462837 .0007559626 |
| Late_v_Early | 19.64731598 .0021418943 |
| Early_v_Late | -2.845511436 .0027781627 |
| Late_v_Early | -.215427205 .0067469666 |
| Early_v_Late | -3.231632233 .0012095402 |
| Late_v_Early | -2.357027531 .0025702729 |
| Early_v_Late | 3.202227831 .0039688039 |
| Late_v_Early | 6.197752476 .0074966296 |
| Early_v_Late | -.0546139181 .0011339439 |
| Late_v_Early | .2491527498 .0019277048 |
| Early_v_Late | -4.581885338 .0006929658 |
| Late_v_Early | -6.757017612 .0010709471 |
| Early_v_Late | 23.70957756 .0003023851 |
| Late_v_Early | 21.65239143 .0004283788 |
| Early_v_Late | -5.129266739 .0007370636 |
| Late_v_Early | 2.485960007 .0009638524 |
| Early_v_Late | 9.392490387 .0009449533 |
| Late_v_Early | .7609612942 .0024568787 |
| Early_v_Late | -8.653765678 .0010583477 |
| Late_v_Early | 20.62852859 .0022930868 |
| Early_v_Late | 2.299735785 .0040129018 |
| Late_v_Early | 3.604630232 .0074525319 |
| Early_v_Late | 3.223866224 .0018143104 |
| Late_v_Early | 4.552188396 .0029482542 |
| Early_v_Late | 6.547305107 .006236692 |
| Late_v_Early | 10.9064064 .0090085548 |
| Early_v_Late | 5.205688 .0018899067 |
| Late_v_Early | 6.71902132 .0024568787 |
| Early_v_Late | -.8521057963 .0012473383 |
| Late_v_Early | -2.820950985 .0014741271 |
| Early_v_Late | 17.60421181 .0006047701 |
| Late_v_Early | 19.93760681 .0006551676 |
| Early_v_Late | -2.688749552 .001719815 |
| Late_v_Early | 9.5492239 .001719815 |
| Early_v_Late | -1.343767166 .0004031801 |
| Late_v_Early | 1.879976273 .0003275838 |
| Early_v_Late | -1.982551336 .0010079502 |
| Late_v_Early | 8.675222397 .0024190804 |
| Early_v_Late | -19.76277542 .0011339439 |
| Late_v_Early | 28.40373802 .0022678879 |
| Early_v_Late | -5.887892723 .0043215866 |
| Late_v_Early | 11.7344656 .0074084342 |
| Early_v_Late | -.348316431 .001965503 |
| Late_v_Early | 13.98102951 .0029482542 |
| Early_v_Late | 6.036512852 .0068036641 |
| Late_v_Early | 21.13029671 .0090715515 |
| Early_v_Late | 3.112169027 .0020788973 |
| Late_v_Early | 16.37677193 .0024946767 |
| Early_v_Late | .1411235332 .0013859315 |
| Late_v_Early | 9.925600052 .0015119253 |
| Early_v_Late | 16.27362823 .0006803664 |
| Late_v_Early | 29.59807777 .0006803664 |
| Early_v_Late | -1.641644478 .001965503 |
| Late_v_Early | 22.16219139 .0018143104 |
| Early_v_Late | -2.667479753 .0005039751 |
| Late_v_Early | 12.13856983 .0003779813 |
| Early_v_Late | 5.63313818 .0001259938 |
| Late_v_Early | 16.86439133 .0000755963 |
| Always_v_timing | -7.043688925 .3844322134 |
| Never_v_timing | -5.330906825 .2402701287 |
+---------------------------------------------------+